<?php
/**
 * @Author: liuhongbin
 * @Email: 514660094@qq.com
 * @Date: 2019-02-12 16:15:10
 * @Description:
 * @LastEditors: liuhongbin
 * @LastEditTime: xxx
 */

namespace addons\gs_developer\model;

class EventModel extends DevBaseModel
{
    protected $name = self::NAME_PREFIX . 'event';

    protected $type = array(
        'value' => 'json'
    );

    public $titles = array(
        'demo_wx_wechat_notify'   => '微信支付通知',
        'wechat_message'          => '微信通讯消息',
        'system_create_url'       => '创建自定义链接地址',
        'wework_kf_message'       => '企业微信客服消息',
        'wework_customer_message' => '企业微信客户联系事件消息',
    );

    public function createEvent($name, $value, $title)
    {
        return $this->save([
            'name'      => $name,
            'value'     => $value,
            'title'     => $title,
            'remark'    => '',
            'replay_id' => request()->eventReplayId ? request()->eventReplayId : 0,
            'replay'    => request()->eventReplay ? 1 : 0
        ]);
    }
}
